#pragma once

#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>

namespace TestDX
{

class Input
{
public:
	Input();
	~Input();

	bool Init(HINSTANCE, HWND);
	void Shutdown();

	bool Frame();

	bool IsEscapePressed();
	void GetMouseMovement(int &, int &);

private:
	// Copy and assign are forbidden
	Input(const Input &);
	Input & operator=(const Input &);

	bool ReadKeyboard();
	bool ReadMouse();
	void ProcessInput();

	// Attribs
	IDirectInput8 * _pDI;
	IDirectInputDevice8 * _pKeyboard;
	IDirectInputDevice8 * _pMouse;

	static const unsigned int NUM_KEYS = 256;

	// Used to record current state of keyboard/mouse
	BYTE _keyboardState[NUM_KEYS];
	DIMOUSESTATE _mouseState;

	int _mouseDX, _mouseDY;
};

}